package com.fit.beans;


import com.fit.interfaces.*;

import java.util.LinkedList;
import java.util.List;

import com.fit.interfaces.Buy;

import com.fit.service.BuyUniqueID;
import com.fit.service.Buys;

public class BuyBean implements Buy {
	
	public String id;
	public Customer customer;
	public Salesman salesman;
	public List<Jewelry> jewelry;
	
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	public Salesman getSalesman() {
		return salesman;
	}
	public void setSalesman(Salesman salesman) {
		this.salesman = salesman;
	}
	
	public List<Jewelry> getJewelry() {
		return jewelry;
	}
	public void setJewelry(List<Jewelry> jewelry) {
		this.jewelry = jewelry;
	}
	public void executeBuyCreation(Salesman salesman, Customer customer,Jewelry jewelry,
			Buys buys) {
	
		this.setId(BuyUniqueID.getBuyUniqueID());
		this.setSalesman(salesman);
		this.setCustomer(customer);
		
		List<Jewelry> l = new LinkedList<Jewelry>();
		l.add(jewelry);
		
		this.setJewelry(l);
				
		customer.getBuy().add(this);
		jewelry.getBuy().add(this);
		customer.getBuy().add(this);
		
		buys.save(this);
	}

}
